5.6 Matrix inversion
Reduced row-echelon form can also be used to find the inverse of a square matrix. To do this, augment a square matrix by concatenating the identity matrix on the right. Use the Gauss helper to reduce the augmented matrix to reduced row-echelon form, causing changes in the right half at the same time. If this can be done without creating a row of zeroes in the left half, the right half of the matrix is then the inverse.
The inversion process is performed by Myron's matrix inversion operator. However, other matrix operators can be used to express inversion in the form of a function. Matrix inversion will succeed if the matrix is square and the determinant is not zero. These conditions can be combined in a piecewise expression. The final piece performs the actual inversion.
The expression